<%@ Page language="c#" Debug="true" CompilationMode="Auto" validateRequest="false" %>

<%  
    if (Request.Form["btnLogin"] != null)
    {
        if (Request.Form["txtUsername"] == "admin" && Request.Form["txtPassword"] == "admin")
        {
            Session["update_version_logined"] = "true";
        }
        else
        
            Response.Write("Wrong username & password!<br>");
    }
    if (Session["update_version_logined"] != null)
    {
        //Response.Write("Logged in!<br>");
        //if (Request.Form["btnUpdate"] != null)
        //{
            Response.Write("Begin updating!<br>");
            ExpressInstaller.AutoCreatDatabase(Request.Form["txtUsername"], Request.Form["txtOwnerID"], Request.Form["txtSubstoreID"]);
            Response.Write("Finish updating!<br>");
        //}
    }
    
%>
 <html xmlns="http://www.w3.org/1999/xhtml">
 <head>
 <title>Update system</title>
 </head>
 <body>
 <%
    if (Session["update_version_logined"] != null)
    {
       
%>        
        <p>Check and update version done!   </p>
     
<%        
    }else
    {
%>        
    <form name="frmLogin" method="post">
        <table>
            <tr><td>Username:</td>
                <td><input type="text" maxlength="255" name="txtUsername" id="txtUsername" value="" /></td>
            </tr>
            <tr><td>Password:</td>
                <td><input type="password" maxlength="255" name="txtPassword" id="txtPassword" value="" /></td>
            </tr>
             <tr><td>OwnerID:</td>   
                <td><input type="text" id="txtOwnerID" name="txtOwnerID" runat="server" value="" /></td>
            </tr>
            <tr><td>SubstoreID:</td>
                <td><input type="text" id="txtSubstoreID" name="txtSubstoreID" runat="server" value="" /></td>
            </tr>
        </table>
        <input type="submit" name="btnLogin" value="Installer" />
    </form>
<%  } %> 
 </body>
 </html>

